# Description:
#   Contains ops for statistical distributions (with pdf, cdf, sample, etc...).
#   APIs here are meant to evolve over time.

package(default_visibility = [
    "//learning/brain/contrib/bayesflow:__subpackages__",
    "//tensorflow:__subpackages__",
])

licenses(["notice"])  # Apache 2.0

exports_files(["LICENSE"])

load("//tensorflow:tensorflow.bzl", "cuda_py_test")

py_library(
    name = "bijectors_py",
    srcs = glob(["python/ops/bijectors/*.py"]),
    deprecation = ("TensorFlow Distributions has migrated to " +
                   "TensorFlow Probability " +
                   "(https://github.com/tensorflow/probability). " +
                   "Deprecated copies remaining in tf.contrib.distributions " +
                   "are unmaintained, unsupported, and will be removed by " +
                   "late 2018. You should update all usage of " +
                   "`tf.contrib.distributions` to `tfp.distributions`."),
    srcs_version = "PY2AND3",
    deps = [
        "//tensorflow/python:array_ops",
        "//tensorflow/python:check_ops",
        "//tensorflow/python:clip_ops",
        "//tensorflow/python:control_flow_ops",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:init_ops",
        "//tensorflow/python:layers",
        "//tensorflow/python:linalg_ops",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:nn_ops",
        "//tensorflow/python:template",
        "//tensorflow/python:tensor_util",
        "//tensorflow/python:util",
        "//tensorflow/python:variable_scope",
        "//tensorflow/python/ops/distributions",
        "//tensorflow/python/ops/linalg",
        "//third_party/py/numpy",
    ],
)

py_library(
    name = "distributions_py",
    srcs = ["__init__.py"] + glob(["python/ops/*.py"]),
    deprecation = ("TensorFlow Distributions has migrated to " +
                   "TensorFlow Probability " +
                   "(https://github.com/tensorflow/probability). " +
                   "Deprecated copies remaining in tf.contrib.distributions " +
                   "are unmaintained, unsupported, and will be removed by " +
                   "late 2018. You should update all usage of " +
                   "`tf.contrib.distributions` to `tfp.distributions`."),
    srcs_version = "PY2AND3",
    deps = [
        ":bijectors_py",
        "//tensorflow/contrib/framework:framework_py",
        "//tensorflow/contrib/learn",
        "//tensorflow/python:array_ops",
        "//tensorflow/python:check_ops",
        "//tensorflow/python:control_flow_ops",
        "//tensorflow/python:data_flow_ops",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:histogram_ops",
        "//tensorflow/python:init_ops",
        "//tensorflow/python:linalg_ops",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:nn",
        "//tensorflow/python:nn_ops",
        "//tensorflow/python:random_ops",
        "//tensorflow/python:state_ops",
        "//tensorflow/python:tensor_util",
        "//tensorflow/python:util",
        "//tensorflow/python:variable_scope",
        "//tensorflow/python:variables",
        "//tensorflow/python/ops/distributions",
        "//tensorflow/python/ops/linalg",
        "//tensorflow/python/ops/signal",
        "//third_party/py/numpy",
        "@six_archive//:six",
    ],
)

cuda_py_test(
    name = "estimator_test",
    size = "small",
    srcs = ["python/kernel_tests/estimator_test.py"],
    additional_deps = [
        ":distributions_py",
        "//third_party/py/numpy",
        "@six_archive//:six",
        "//tensorflow/contrib/learn",
        "//tensorflow/contrib/learn:head_test",
        "//tensorflow/python/ops/distributions",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_ops",
        "//tensorflow/python:nn_ops",
        "//tensorflow/python:session",
    ],
    tags = ["no_pip"],  # contrib/learn:head_test is not available in pip.
)

cuda_py_test(
    name = "distribution_test",
    size = "medium",
    srcs = ["python/kernel_tests/distribution_test.py"],
    additional_deps = [
        ":distributions_py",
        "//tensorflow/python:array_ops",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:platform_test",
        "//tensorflow/python:random_ops",
    ],
)

cuda_py_test(
    name = "conditional_distribution_test",
    size = "medium",
    srcs = [
        "python/kernel_tests/conditional_distribution_test.py",
        "python/kernel_tests/distribution_test.py",
    ],
    additional_deps = [
        ":distributions_py",
        "//tensorflow/python:array_ops",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:platform_test",
        "//tensorflow/python:random_ops",
    ],
    tags = ["no_pip"],
)

cuda_py_test(
    name = "autoregressive_test",
    size = "small",
    srcs = ["python/kernel_tests/autoregressive_test.py"],
    additional_deps = [
        ":distributions_py",
        "//third_party/py/numpy",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "binomial_test",
    size = "small",
    srcs = ["python/kernel_tests/binomial_test.py"],
    additional_deps = [
        ":distributions_py",
        "//third_party/py/numpy",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:platform_test",
    ],
    tags = ["notap"],
)

cuda_py_test(
    name = "cauchy_test",
    size = "medium",
    srcs = ["python/kernel_tests/cauchy_test.py"],
    additional_deps = [
        ":distributions_py",
        "//third_party/py/numpy",
        "//tensorflow/python:array_ops",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:gradients",
        "//tensorflow/python:platform_test",
        "//tensorflow/python:variables",
    ],
)

cuda_py_test(
    name = "chi2_test",
    srcs = ["python/kernel_tests/chi2_test.py"],
    additional_deps = [
        ":distributions_py",
        "//third_party/py/numpy",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "deterministic_test",
    size = "small",
    srcs = ["python/kernel_tests/deterministic_test.py"],
    additional_deps = [
        ":distributions_py",
        "//third_party/py/numpy",
        "//tensorflow/python:client",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:nn_ops",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "geometric_test",
    size = "small",
    srcs = ["python/kernel_tests/geometric_test.py"],
    additional_deps = [
        ":distributions_py",
        "//third_party/py/numpy",
        "//tensorflow/python:client",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:nn_ops",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "half_normal_test",
    size = "medium",
    srcs = ["python/kernel_tests/half_normal_test.py"],
    additional_deps = [
        ":distributions_py",
        "//third_party/py/numpy",
        "//tensorflow/python:client",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:gradients",
        "//tensorflow/python:nn_ops",
        "//tensorflow/python:platform_test",
        "//tensorflow/python:variables",
    ],
)

cuda_py_test(
    name = "inverse_gamma_test",
    srcs = ["python/kernel_tests/inverse_gamma_test.py"],
    additional_deps = [
        ":distributions_py",
        "//third_party/py/numpy",
        "//tensorflow/python:client",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:nn_ops",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "kumaraswamy_test",
    srcs = ["python/kernel_tests/kumaraswamy_test.py"],
    additional_deps = [
        ":distributions_py",
        "//third_party/py/numpy",
        "//tensorflow/python:client",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:nn_ops",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "moving_stats_test",
    size = "small",
    srcs = ["python/kernel_tests/moving_stats_test.py"],
    additional_deps = [
        ":distributions_py",
        "//third_party/py/numpy",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:nn_ops",
        "//tensorflow/python:platform_test",
    ],
    tags = ["nomsan"],  # disable to avoid false positives from scipy.
)

cuda_py_test(
    name = "mvn_diag_test",
    size = "medium",
    srcs = ["python/kernel_tests/mvn_diag_test.py"],
    additional_deps = [
        ":distributions_py",
        "//third_party/py/numpy",
        "//tensorflow/python:array_ops",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:nn_ops",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "mvn_diag_plus_low_rank_test",
    size = "medium",
    srcs = ["python/kernel_tests/mvn_diag_plus_low_rank_test.py"],
    additional_deps = [
        ":distributions_py",
        "//third_party/py/numpy",
        "//tensorflow/python:array_ops",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:nn_ops",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "mvn_full_covariance_test",
    size = "small",
    srcs = ["python/kernel_tests/mvn_full_covariance_test.py"],
    additional_deps = [
        ":distributions_py",
        "//third_party/py/numpy",
        "//tensorflow/python:array_ops",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:nn_ops",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "mvn_tril_test",
    size = "medium",
    srcs = ["python/kernel_tests/mvn_tril_test.py"],
    additional_deps = [
        ":distributions_py",
        "//third_party/py/numpy",
        "//tensorflow/python:array_ops",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:nn_ops",
        "//tensorflow/python:platform_test",
    ],
    tags = ["nomsan"],
)

cuda_py_test(
    name = "mixture_test",
    size = "medium",
    srcs = ["python/kernel_tests/mixture_test.py"],
    additional_deps = [
        ":distributions_py",
        "//third_party/py/numpy",
        "//tensorflow/core:protos_all_py",
        "//tensorflow/python:array_ops",
        "//tensorflow/python:client",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:nn_ops",
        "//tensorflow/python:platform_test",
        "//tensorflow/python:random_ops",
        "//tensorflow/python:variables",
    ],
    shard_count = 4,
)

cuda_py_test(
    name = "mixture_same_family_test",
    size = "small",
    srcs = ["python/kernel_tests/mixture_same_family_test.py"],
    additional_deps = [
        ":distributions_py",
        "//third_party/py/numpy",
        "//tensorflow/python:array_ops",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:client_testlib",
    ],
)

cuda_py_test(
    name = "negative_binomial_test",
    size = "small",
    srcs = ["python/kernel_tests/negative_binomial_test.py"],
    additional_deps = [
        ":distributions_py",
        "//third_party/py/numpy",
        "//tensorflow/python:client",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:nn_ops",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "poisson_test",
    size = "small",
    srcs = ["python/kernel_tests/poisson_test.py"],
    additional_deps = [
        ":distributions_py",
        "//third_party/py/numpy",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "poisson_lognormal_test",
    size = "medium",
    srcs = ["python/kernel_tests/poisson_lognormal_test.py"],
    additional_deps = [
        ":distributions_py",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "sinh_arcsinh_test",
    size = "medium",
    srcs = ["python/kernel_tests/sinh_arcsinh_test.py"],
    additional_deps = [
        ":distributions_py",
        "//third_party/py/numpy",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "independent_test",
    size = "small",
    srcs = ["python/kernel_tests/independent_test.py"],
    additional_deps = [
        ":distributions_py",
        "//third_party/py/numpy",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:platform_test",
    ],
    tags = ["no_windows"],  # TODO: needs investigation on Windows
)

cuda_py_test(
    name = "batch_reshape_test",
    size = "medium",
    srcs = ["python/kernel_tests/batch_reshape_test.py"],
    additional_deps = [
        ":distributions_py",
        "//third_party/py/numpy",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "sample_stats_test",
    size = "medium",
    srcs = ["python/kernel_tests/sample_stats_test.py"],
    additional_deps = [
        ":distributions_py",
        "//third_party/py/numpy",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:spectral_ops_test_util",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:nn_ops",
        "//tensorflow/python:platform_test",
    ],
    tags = ["nomsan"],  # disable to avoid false positives from scipy.
)

cuda_py_test(
    name = "seed_stream_test",
    size = "small",
    srcs = ["python/kernel_tests/seed_stream_test.py"],
    additional_deps = [
        ":distributions_py",
        "//tensorflow/python:client_testlib",
    ],
)

cuda_py_test(
    name = "statistical_testing_test",
    size = "medium",
    srcs = [
        "python/kernel_tests/statistical_testing_test.py",
    ],
    additional_deps = [
        ":distributions_py",
        "//third_party/py/numpy",
        "//tensorflow/python:client_testlib",
    ],
    shard_count = 4,
)

cuda_py_test(
    name = "vector_sinh_arcsinh_diag_test",
    size = "medium",
    srcs = ["python/kernel_tests/vector_sinh_arcsinh_diag_test.py"],
    additional_deps = [
        ":distributions_py",
        "//third_party/py/numpy",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "vector_exponential_diag_test",
    size = "medium",
    srcs = ["python/kernel_tests/vector_exponential_diag_test.py"],
    additional_deps = [
        ":distributions_py",
        "//third_party/py/numpy",
        "//tensorflow/python:array_ops",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "vector_laplace_diag_test",
    size = "medium",
    srcs = ["python/kernel_tests/vector_laplace_diag_test.py"],
    additional_deps = [
        ":distributions_py",
        "//third_party/py/numpy",
        "//tensorflow/python:array_ops",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "vector_student_t_test",
    size = "medium",
    srcs = ["python/kernel_tests/vector_student_t_test.py"],
    additional_deps = [
        ":distributions_py",
        "//third_party/py/numpy",
        "//tensorflow/python:array_ops",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "wishart_test",
    size = "medium",
    srcs = ["python/kernel_tests/wishart_test.py"],
    additional_deps = [
        ":distributions_py",
        "//third_party/py/numpy",
        "//tensorflow/python:array_ops",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:errors",
        "//tensorflow/python:framework",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "normal_conjugate_posteriors_test",
    size = "small",
    srcs = ["python/kernel_tests/normal_conjugate_posteriors_test.py"],
    additional_deps = [
        ":distributions_py",
        "//tensorflow/python:array_ops",
        "//tensorflow/python:client",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "quantized_distribution_test",
    size = "medium",
    srcs = ["python/kernel_tests/quantized_distribution_test.py"],
    additional_deps = [
        ":distributions_py",
        "//third_party/py/numpy",
        "//tensorflow/python:array_ops",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:gradients",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:platform_test",
        "//tensorflow/python:variables",
    ],
)

cuda_py_test(
    name = "logistic_test",
    size = "small",
    srcs = ["python/kernel_tests/logistic_test.py"],
    additional_deps = [
        ":distributions_py",
        "//tensorflow/python:array_ops",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "relaxed_bernoulli_test",
    size = "small",
    srcs = ["python/kernel_tests/relaxed_bernoulli_test.py"],
    additional_deps = [
        ":distributions_py",
        "//tensorflow/python:array_ops",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "onehot_categorical_test",
    size = "small",
    srcs = ["python/kernel_tests/onehot_categorical_test.py"],
    additional_deps = [
        ":distributions_py",
        "//tensorflow/python:array_ops",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "relaxed_onehot_categorical_test",
    size = "small",
    srcs = ["python/kernel_tests/relaxed_onehot_categorical_test.py"],
    additional_deps = [
        ":distributions_py",
        "//tensorflow/python:array_ops",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "transformed_distribution_test",
    size = "medium",
    srcs = ["python/kernel_tests/transformed_distribution_test.py"],
    additional_deps = [
        ":bijectors_py",
        ":distributions_py",
        "//third_party/py/numpy",
        "//tensorflow/python:array_ops",
        "//tensorflow/python/ops/linalg",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "vector_diffeomixture_test",
    size = "medium",
    srcs = ["python/kernel_tests/vector_diffeomixture_test.py"],
    additional_deps = [
        ":distributions_py",
        "//third_party/py/numpy",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python/ops/linalg",
    ],
    shard_count = 4,
    tags = ["noasan"],  # times out, http://b/78588814
)

cuda_py_test(
    name = "conditional_transformed_distribution_test",
    size = "medium",
    srcs = [
        "python/kernel_tests/conditional_transformed_distribution_test.py",
        "python/kernel_tests/transformed_distribution_test.py",
    ],
    additional_deps = [
        ":distributions_py",
        "//third_party/py/numpy",
        "//tensorflow/python:array_ops",
        "//tensorflow/python/ops/linalg",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:platform_test",
    ],
    tags = ["no_pip"],
)

cuda_py_test(
    name = "distribution_util_test",
    size = "small",
    srcs = ["python/kernel_tests/distribution_util_test.py"],
    additional_deps = [
        ":distributions_py",
        "//third_party/py/numpy",
        "//tensorflow/python:array_ops",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:gradients",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "shape_test",
    size = "medium",
    srcs = ["python/kernel_tests/shape_test.py"],
    additional_deps = [
        ":distributions_py",
        "//third_party/py/numpy",
        "//tensorflow/python:array_ops",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:platform_test",
    ],
)

# === Bijector Tests ==========================================================

cuda_py_test(
    name = "conditional_bijector_test",
    size = "small",
    srcs = ["python/kernel_tests/bijectors/conditional_bijector_test.py"],
    additional_deps = [
        ":bijectors_py",
        ":distributions_py",
        "//third_party/py/numpy",
        "@six_archive//:six",
        "//tensorflow/python:array_ops",
        "//tensorflow/python/ops/linalg",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "absolute_value_test",
    size = "small",
    srcs = ["python/kernel_tests/bijectors/absolute_value_test.py"],
    additional_deps = [
        ":bijectors_py",
        ":distributions_py",
        "//third_party/py/numpy",
        "@six_archive//:six",
        "//tensorflow/python:array_ops",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "affine_test",
    size = "medium",
    srcs = ["python/kernel_tests/bijectors/affine_test.py"],
    additional_deps = [
        ":bijectors_py",
        ":distributions_py",
        "//third_party/py/numpy",
        "@six_archive//:six",
        "//tensorflow/python:array_ops",
        "//tensorflow/python/ops/linalg",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:platform_test",
    ],
    shard_count = 10,
    tags = ["noasan"],  # times out b/63678675
)

cuda_py_test(
    name = "affine_scalar_test",
    size = "small",
    srcs = ["python/kernel_tests/bijectors/affine_scalar_test.py"],
    additional_deps = [
        ":bijectors_py",
        ":distributions_py",
        "//third_party/py/numpy",
        "@six_archive//:six",
        "//tensorflow/python:array_ops",
        "//tensorflow/python/ops/linalg",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "affine_linear_operator_test",
    size = "small",
    srcs = ["python/kernel_tests/bijectors/affine_linear_operator_test.py"],
    additional_deps = [
        ":bijectors_py",
        ":distributions_py",
        "//third_party/py/numpy",
        "@six_archive//:six",
        "//tensorflow/python:array_ops",
        "//tensorflow/python/ops/linalg",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "batch_normalization_test",
    size = "medium",
    srcs = ["python/kernel_tests/bijectors/batch_normalization_test.py"],
    additional_deps = [
        ":bijectors_py",
        ":distributions_py",
        "//third_party/py/numpy",
        "//tensorflow/python:array_ops",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:platform_test",
    ],
    tags = ["optonly"],
)

cuda_py_test(
    name = "chain_test",
    size = "small",
    srcs = ["python/kernel_tests/bijectors/chain_test.py"],
    additional_deps = [
        ":bijectors_py",
        ":distributions_py",
        "//third_party/py/numpy",
        "@six_archive//:six",
        "//tensorflow/python:array_ops",
        "//tensorflow/python/ops/linalg",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "cholesky_outer_product_test",
    size = "small",
    srcs = ["python/kernel_tests/bijectors/cholesky_outer_product_test.py"],
    additional_deps = [
        ":bijectors_py",
        ":distributions_py",
        "//third_party/py/numpy",
        "@six_archive//:six",
        "//tensorflow/python:array_ops",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python/ops/linalg",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "exp_test",
    size = "small",
    srcs = ["python/kernel_tests/bijectors/exp_test.py"],
    additional_deps = [
        ":bijectors_py",
        ":distributions_py",
        "//third_party/py/numpy",
        "@six_archive//:six",
        "//tensorflow/python:array_ops",
        "//tensorflow/python/ops/linalg",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "fill_triangular_test",
    size = "small",
    srcs = ["python/kernel_tests/bijectors/fill_triangular_test.py"],
    additional_deps = [
        ":bijectors_py",
        ":distributions_py",
        "//third_party/py/numpy",
        "@six_archive//:six",
        "//tensorflow/python:array_ops",
        "//tensorflow/python/ops/linalg",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "gumbel_test",
    size = "small",
    srcs = ["python/kernel_tests/bijectors/gumbel_test.py"],
    additional_deps = [
        ":bijectors_py",
        ":distributions_py",
        "//third_party/py/numpy",
        "@six_archive//:six",
        "//tensorflow/python:array_ops",
        "//tensorflow/python/ops/linalg",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "inline_test",
    size = "small",
    srcs = ["python/kernel_tests/bijectors/inline_test.py"],
    additional_deps = [
        ":bijectors_py",
        ":distributions_py",
        "//third_party/py/numpy",
        "@six_archive//:six",
        "//tensorflow/python:array_ops",
        "//tensorflow/python/ops/linalg",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "invert_test",
    size = "small",
    srcs = ["python/kernel_tests/bijectors/invert_test.py"],
    additional_deps = [
        ":bijectors_py",
        ":distributions_py",
        "//third_party/py/numpy",
        "@six_archive//:six",
        "//tensorflow/python:array_ops",
        "//tensorflow/python/ops/linalg",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "kumaraswamy_bijector_test",
    size = "small",
    srcs = ["python/kernel_tests/bijectors/kumaraswamy_bijector_test.py"],
    additional_deps = [
        ":bijectors_py",
        ":distributions_py",
        "//third_party/py/numpy",
        "@six_archive//:six",
        "//tensorflow/python:array_ops",
        "//tensorflow/python/ops/linalg",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "masked_autoregressive_test",
    size = "small",
    srcs = ["python/kernel_tests/bijectors/masked_autoregressive_test.py"],
    additional_deps = [
        ":bijectors_py",
        ":distributions_py",
        "//third_party/py/numpy",
        "//tensorflow/python:array_ops",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "matrix_inverse_tril_test",
    size = "medium",
    srcs = ["python/kernel_tests/bijectors/matrix_inverse_tril_test.py"],
    additional_deps = [
        ":bijectors_py",
        ":distributions_py",
        "//third_party/py/numpy",
        "@six_archive//:six",
        "//tensorflow/python:array_ops",
        "//tensorflow/python/ops/linalg",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "real_nvp_test",
    size = "small",
    srcs = ["python/kernel_tests/bijectors/real_nvp_test.py"],
    additional_deps = [
        ":bijectors_py",
        ":distributions_py",
        "//third_party/py/numpy",
        "//tensorflow/python:array_ops",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "permute_test",
    size = "small",
    srcs = ["python/kernel_tests/bijectors/permute_test.py"],
    additional_deps = [
        ":bijectors_py",
        ":distributions_py",
        "//third_party/py/numpy",
        "//tensorflow/python:array_ops",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "power_transform_test",
    size = "small",
    srcs = ["python/kernel_tests/bijectors/power_transform_test.py"],
    additional_deps = [
        ":bijectors_py",
        ":distributions_py",
        "//third_party/py/numpy",
        "@six_archive//:six",
        "//tensorflow/python:array_ops",
        "//tensorflow/python/ops/linalg",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "reshape_test",
    size = "medium",
    srcs = ["python/kernel_tests/bijectors/reshape_test.py"],
    additional_deps = [
        ":bijectors_py",
        ":distributions_py",
        "//third_party/py/numpy",
        "//tensorflow/python:array_ops",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "scale_tril_test",
    size = "small",
    srcs = ["python/kernel_tests/bijectors/scale_tril_test.py"],
    additional_deps = [
        ":bijectors_py",
        ":distributions_py",
        "//third_party/py/numpy",
        "@six_archive//:six",
        "//tensorflow/python:array_ops",
        "//tensorflow/python/ops/linalg",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "sigmoid_test",
    size = "small",
    srcs = ["python/kernel_tests/bijectors/sigmoid_test.py"],
    additional_deps = [
        ":bijectors_py",
        ":distributions_py",
        "//third_party/py/numpy",
        "@six_archive//:six",
        "//tensorflow/python:array_ops",
        "//tensorflow/python/ops/linalg",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:platform_test",
    ],
)

# Tests for SinhArcSinh bijector.  The file name has the extra "_bijector" to
# avoid BUILD rule name conflicts with the distribution by the same name.
cuda_py_test(
    name = "sinh_arcsinh_bijector_test",
    size = "small",
    srcs = ["python/kernel_tests/bijectors/sinh_arcsinh_bijector_test.py"],
    additional_deps = [
        ":bijectors_py",
        ":distributions_py",
        "//third_party/py/numpy",
        "@six_archive//:six",
        "//tensorflow/python:array_ops",
        "//tensorflow/python/ops/linalg",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:platform_test",
    ],
    tags = ["no_windows"],  # TODO: needs investigation on Windows
)

cuda_py_test(
    name = "softmax_centered_test",
    size = "small",
    srcs = ["python/kernel_tests/bijectors/softmax_centered_test.py"],
    additional_deps = [
        ":bijectors_py",
        ":distributions_py",
        "//third_party/py/numpy",
        "@six_archive//:six",
        "//tensorflow/python:array_ops",
        "//tensorflow/python/ops/linalg",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "softplus_test",
    size = "small",
    srcs = ["python/kernel_tests/bijectors/softplus_test.py"],
    additional_deps = [
        ":bijectors_py",
        ":distributions_py",
        "//third_party/py/numpy",
        "@six_archive//:six",
        "//tensorflow/python:array_ops",
        "//tensorflow/python/ops/linalg",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "softsign_test",
    size = "small",
    srcs = ["python/kernel_tests/bijectors/softsign_test.py"],
    additional_deps = [
        ":bijectors_py",
        ":distributions_py",
        "//third_party/py/numpy",
        "@six_archive//:six",
        "//tensorflow/python:array_ops",
        "//tensorflow/python/ops/linalg",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "square_test",
    size = "small",
    srcs = ["python/kernel_tests/bijectors/square_test.py"],
    additional_deps = [
        ":bijectors_py",
        ":distributions_py",
        "//third_party/py/numpy",
        "@six_archive//:six",
        "//tensorflow/python:array_ops",
        "//tensorflow/python/ops/linalg",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "transform_diagonal_test",
    size = "small",
    srcs = ["python/kernel_tests/bijectors/transform_diagonal_test.py"],
    additional_deps = [
        ":bijectors_py",
        ":distributions_py",
        "//third_party/py/numpy",
        "@six_archive//:six",
        "//tensorflow/python:array_ops",
        "//tensorflow/python/ops/linalg",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:platform_test",
    ],
)

cuda_py_test(
    name = "weibull_test",
    size = "small",
    srcs = ["python/kernel_tests/bijectors/weibull_test.py"],
    additional_deps = [
        ":bijectors_py",
        ":distributions_py",
        "//third_party/py/numpy",
        "@six_archive//:six",
        "//tensorflow/python:array_ops",
        "//tensorflow/python/ops/linalg",
        "//tensorflow/python:client_testlib",
        "//tensorflow/python:framework_for_generated_wrappers",
        "//tensorflow/python:framework_test_lib",
        "//tensorflow/python:math_ops",
        "//tensorflow/python:platform_test",
    ],
)
